
local Navigator = {
    currFrame = nil,
}

local this = Navigator

function Navigator.init()
end

function Navigator.enterFrame(frameCfg)
    this.exitCurrFrame()

    print("enter frame name "..frameCfg.name)
    local frame = frameCfg.cls.new()
    frame:start()
    this.currFrame = frame
end

function Navigator.exitCurrFrame()
    if this.currFrame == nil then
        return
    end
    this.currFrame:onDestroy()
    this.currFrame = nil
end


return Navigator